package com.waikuai.shop.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.waikuai.shop.dto.ProductDTO;
import com.waikuai.shop.entity.Product;
import com.waikuai.shop.vo.ProductDetailVO;
import com.waikuai.shop.vo.ProductSimpleVO;

import java.util.List;

public interface ProductService extends IService<Product> {

    IPage<ProductSimpleVO> getProductPage(Page<ProductSimpleVO> page,
                                         Long categoryId,
                                         String keyword,
                                         Integer status,
                                         Integer isFeatured,
                                         String orderBy,
                                         String orderType);

    List<ProductSimpleVO> getHotProducts(Integer limit);

    List<ProductSimpleVO> getNewProducts(Integer limit);

    List<ProductSimpleVO> getFeaturedProducts(Integer limit);

    List<ProductSimpleVO> getProductsByCategoryId(Long categoryId, Integer limit);

    List<ProductSimpleVO> searchProducts(String keyword, Integer limit);

    ProductDetailVO getProductDetail(Long productId, Long userId);

    boolean createProduct(ProductDTO productDTO);

    boolean updateProduct(ProductDTO productDTO);

    boolean deleteProduct(Long productId);

    boolean updateStock(Long productId, Integer quantity);

    boolean putOnShelf(Long productId);

    boolean pullOffShelf(Long productId);

    boolean setFeatured(Long productId, Boolean featured);

    boolean incrementViewCount(Long productId);

    boolean checkProductNameExists(String productName, Long excludeId);

    boolean checkProductCodeExists(String productCode, Long excludeId);

    ProductSimpleVO convertToSimpleVO(Product product);

    ProductDetailVO convertToDetailVO(Product product, Long userId);
}
